package com.example.demo.entity;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.io.Serializable;

//@Component
public class User implements Serializable {
    private String user_id;
    private String user_password;
    private String user_name;
    private String user_telephone;
    //@Autowired//不知道为啥注入不进来，获取时报空指针异常
    private Address user_address;
    private String user_mailbox;

    public User() {
    }

    public User(String user_id, String user_password, String user_name, String user_telephone, Address user_address, String user_mailbox) {
        this.user_id = user_id;
        this.user_password = user_password;
        this.user_name = user_name;
        this.user_telephone = user_telephone;
        this.user_address = user_address;
        this.user_mailbox = user_mailbox;
    }

    public String getUser_id() {
        return user_id;
    }

    public void setUser_id(String user_id) {
        this.user_id = user_id;
    }

    public String getUser_password() {
        return user_password;
    }

    public void setUser_password(String user_password) {
        this.user_password = user_password;
    }

    public String getUser_name() {
        return user_name;
    }

    public void setUser_name(String user_name) {
        this.user_name = user_name;
    }

    public String getUser_telephone() {
        return user_telephone;
    }

    public void setUser_telephone(String user_telephone) {
        this.user_telephone = user_telephone;
    }

    public String getUser_address() {
        return user_address.toString();
    }

    public void setUser_address(String user_address) {
        this.user_address = new Address(user_address);
//        this.user_address.setValue(user_address);
    }

    public String getUser_mailbox() {
        return user_mailbox;
    }

    public void setUser_mailbox(String user_mailbox) {
        this.user_mailbox = user_mailbox;
    }

    @Override
    public String toString() {
        return "User{" +
                "user_id= " + user_id +
                ", user_password= " + user_password +
                ", user_name= " + user_name +
                ", user_telephone= " + user_telephone +
                ", user_address= " + user_address +
                ", user_mailbox= " + user_mailbox +
                '}';
    }
}
